home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16337 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
  4. Subject: Re: fastest code
  5. Date: 10 Apr 1996 08:05:23 -0500
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4kgbmj$j3j@solutions.solon.com>
  8. References: <316112A2.7D37@public.sta.net.cn> <4k4ll5$fq@solutions.solon.com> <4ke5v6$17k@samba.rahul.net> <1996Apr10.110121.6784@friend.kastle.com>
  9. Reply-To: seebs@solon.com
  10. NNTP-Posting-Host: solutions.solon.com
  11.  
  12. In article <1996Apr10.110121.6784@friend.kastle.com>,
  13. Richard Krehbiel <rich@kastle.com> wrote:
  14. >Oliver Hellwig <hellwig@rahul.net> wrote:
  15. >>         for (i=0; i<16; i++)
  16. >>             prom[i] = prom[i+i];
  17.  
  18. >>The output of the compiler left the loop but removed the 
  19. >>assignment!
  20.  
  21. >I suspect a proper "volatile" declaration on "prom" might have fixed
  22. >this, i.e. if "prom" is currently declared "char prom[16]" then it
  23. >should be declared "volatile char prom[16]".  I would not consider
  24. >this an optimizer bug in Watcom.
  25.  
  26. HUH?  the code as written has a clear effect, which is to shove all of
  27. the elements of an array over one.  It certainly is an optimizer bug.
  28.  
  29. Read the code carefully; the 2nd reference to prom[] uses a different
  30. index into the array.  This is not a meaningless statement.
  31.  
  32. -s
  33. -- 
  34. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  35. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  36. FUCK the communications decency act.  Goddamned government.  [literally.]
  37. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  38.